<template>
  <ContentWrap :style="`height: ${contentHeight}px`">
    <div class="mb-10px">
      <el-button @click="closeView">关闭</el-button>
    </div>
    <el-scrollbar :max-height="`${contentHeight - 62}px`">
      <div class="mainTitle">物料清单</div>
      <el-table border v-loading="formLoading" :data="list" :header-cell-style="headFirst">
        <el-table-column label="编号" align="left">
          <el-table-column label="编号" align="left" prop="code" />
          <el-table-column label="编号" align="left" prop="codeTwo" />
          <el-table-column label="编号" align="left" prop="codeThree" />
          <el-table-column label="编号" align="left" prop="codeFour" />
          <el-table-column label="编号" align="left" prop="codeFive" />
        </el-table-column>
        <el-table-column label="部件编号" align="left" prop="partNumber" min-width="200" />
        <el-table-column label="部件名称" align="left" prop="partName" min-width="200" />
        <el-table-column label="图纸图号" align="left" prop="drawingNumber" min-width="200" />
        <el-table-column label="部件规格" align="left" prop="partSpecification" min-width="200" />
        <el-table-column label="材质" align="left" prop="material" min-width="200" />
        <el-table-column label="规格" align="left" prop="specification" min-width="200" />
        <el-table-column label="净尺寸(长)" align="left" prop="netSizeLength" min-width="200" />
        <el-table-column label="净尺寸(宽)" align="left" prop="netSizeWidth" min-width="200" />
        <el-table-column label="下料尺寸(长)" align="left" prop="cuttingSizeLength" min-width="200" />
        <el-table-column label="下料尺寸(宽)" align="left" prop="cuttingSizeWidth" min-width="200" />
        <el-table-column label="基本用量" align="left" prop="basicDosage" min-width="200" />
        <el-table-column label="单位" header-align="left" align="left" prop="partUnit" min-width="200px" />
      </el-table>
    </el-scrollbar>
  </ContentWrap>
</template>
<script setup lang="ts">
import * as ComponentApi from '@/api/componentApi/index'

const list = ref([])
const formLoading = ref(false)
const contentHeight = ref(0)

const getData = async (productNumber, partNumber) => {
  list.value = await ComponentApi.getProcessManagementMaterials({ productNumber: productNumber, partNumber: partNumber })
  contentHeight.value = document.body.clientHeight - 126
}
defineExpose({ getData })

// 合并编号
const headFirst = ({ rowIndex }) => {
  if (rowIndex === 1) {
    return { display: 'none' }
  }
}
const emit = defineEmits(['closeView'])
const closeView = () => {
emit('closeView')
}

</script>
<style lang="scss" scoped>
.mainTitle {
  font-size: 16px;
  font-weight: bold;
  margin-bottom: 10px;
}
</style>
